--
-- Created by IntelliJ IDEA.
-- User: Bradish7Y
-- Date: 2017/9/15
-- Time: 17:02
-- To change this template use File | Settings | File Templates.
--

local list_key = KEYS[1];
local session_id = ARGV[1];
local list = redis.call('LRANGE', list_key, 0, -1);
local exist_key = false;
if #list > 0 then
    for x = 1, #list do
        if list[x] == session_id then
            exist_key = true;
            break;
        end;
    end;
end;
if not exist_key then
    redis.call('RPUSH', list_key, session_id);
    -- redis.call('EXPIRE', list_key, ARGV[2]);
end;

return exist_key == false;